package com.jin.webvideo.mapper;

import com.jin.webvideo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserMapper {
    @Select("select count(1) from user where account=#{account}")
    boolean hasAccount(String account);

    @Insert("insert into user(account, password, salt, activekey) values(#{account}, #{password}, #{salt}, #{activekey})")
    int register(String account, String password, String salt, String activekey);

    @Select("select img, account, role as roles from user where account=#{account} and password=#{password}")
    User userCanLogin(String account, String password);
}
